package com.hdu.point_offer;

public class lcr121 {
    class Solution {
        public boolean findTargetIn2DPlants(int[][] plants, int target) {
            int curX = 0;
            int curY = plants[0].length - 1;
            while (curX < plants.length && curY >= 0) {
                if (plants[curX][curY] == target) {
                    return true;
                }
                if (plants[curX][curY] > target) {
                    curY--;
                } else {
                    curX++;
                }
            }
            return false;
        }
    }
}
